package org.daemon.believe.mythink.common;

import java.util.List;

public class PageWrap<T> {

	private List<T> rows;
	private int pageNumber;
	private int pageSize;
	private int total;
	private int totalPage;
	
	public List<T> getRows() {
		return rows;
	}
	public void setRows(List<T> rows) {
		this.rows = rows;
	}
	public int getPageNumber() {
		return pageNumber;
	}
	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}
	public int getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	
	public PageWrap(int pageNumber, int pageSize, int total) {
		super();
		this.pageNumber = pageNumber;
		this.pageSize = pageSize;
		this.total = total;
		if(this.pageNumber <1){
			this.pageNumber =1;
		}
		if(this.pageSize <1){
			this.pageSize =10;
		}
		this.totalPage = (this.total + this.pageSize-1)/this.pageSize;
		if(this.totalPage <1){
			this.totalPage=0;
		}
		if(this.totalPage > 0 && this.pageNumber > this.totalPage){
			this.pageNumber = this.totalPage;
		}
	}
	
	
	
}
